import 'package:flutter/material.dart';

class ProgressRoute extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return _ProgressRoute();
  }

}

class _ProgressRoute extends State<ProgressRoute> with SingleTickerProviderStateMixin{

  late AnimationController _animationController;

  @override
  void initState() {
    print("initState");
    super.initState();
    _animationController = AnimationController(
      vsync: this,
      duration: Duration(seconds: 3)
    );
    _animationController.forward();
    _animationController.addListener((){
      print("animation: ${_animationController.value}");
      setState(() {
        
      });
    });
  }

  @override
  void dispose() {
    super.dispose();
    _animationController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.all(16),
            child: LinearProgressIndicator(
              backgroundColor: Colors.grey[200],
              valueColor: ColorTween(begin: Colors.red,end: Colors.blue)
              .animate(_animationController),
              value: _animationController.value,
            ),
          )
          
        ],
      ),
    );
  }
  
}